luci-mod-status: consider family when rendering chains and rules
authorStefan Kleeschulte <[email protected]>
Fri, 17 Jan 2025 12:42:34 +0000 (13:42 +0100)
committerPaul Donald <[email protected]>
Tue, 8 Apr 2025 18:37:39 +0000 (20:37 +0200)
There can be multiple tables with the same name but different family
attribute (inet, ip, ip6, ...). The same goes for chains. So the family
attribute needs to be considered when rendering chains and rules.

Signed-off-by: Stefan Kleeschulte <[email protected]>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js

index 406f134327337101258d76274cb44e49ac690a40..0013a3a116ba59db23656217ac391081ddb4ea1d 100644 (file)
@@ -607,7 +607,7 @@ return view.extend({
                ]));
 
                for (var i = 0; i < data.length; i++)
-                       if (typeof(data[i].rule) == 'object' && data[i].rule.table == spec.table && data[i].rule.chain == spec.name)
+                       if (typeof(data[i].rule) == 'object' && data[i].rule.table == spec.table && data[i].rule.chain == spec.name && data[i].rule.family == spec.family)
                                node.lastElementChild.appendChild(this.renderRule(data, data[i].rule));
 
                if (node.lastElementChild.childNodes.length == 1)
@@ -669,7 +669,7 @@ return view.extend({
                ]);
 
                for (var i = 0; i < data.length; i++)
-                       if (typeof(data[i].chain) == 'object' && data[i].chain.table == spec.name)
+                       if (typeof(data[i].chain) == 'object' && data[i].chain.table == spec.name && data[i].chain.family == spec.family)
                                node.lastElementChild.lastElementChild.appendChild(this.renderChain(data, data[i].chain));
 
                return node;